template_friend.cpp:2: warning: friend declaration `bool operator==(const A<T>&, const A<T>&)' declares a non-template function
template_friend.cpp:2: warning: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning.
template <class U, class T> std::pair<U, ptrdiff_t> minof(T begin , T end ) { U min = std::numeric_limits<U>::max(); T min_it = end; for( T i = begin; i != end; i++ ) { if (*i < min) { min = *i; min_it = i; } } return std::pair<U, ptrdiff_t>( min, std::distance( begin, min_it ) ); }