I have been bitten recently by ADL (Argument Dependant Lookup) similarly to this link. The consensus seems to be that operator overloading should always be done in one of the arguments’ namespace to avoid this kind of issues.
However, with STL types, this is not an option since it is UB to write code in namespace std.
What would you do if you wanted to define for example a stream operator for std::list<int>
?
1