Consider this question, which is about the following code not compiling:
std::vector a, b;
std::cout << (std::ref(a) < std::ref(b));
Given that, is there a reason to prefer the non-member function template that we currently have, or should this be considered a defect in the standard?
The reason is if ADL could find out proper function or not. When such a search requires to extract the substituted template parameters from the type of given object and then substitute them many times into a templated parameter of the function template, ADL can't do this because of there are no reasons in the general case to prefer one way of template parameters binding to other. The non-member function template defined after but still in the namespace scope of that template (due to friend
) excludes such an indeterminacy.