C++ can't find function out of namespace
问题 Compiling the following code fails because the second function can't find the first one, even though it's outside namespaces. I couldn't figure out the problem myself, and so far I haven't found any answers on the net. test.cpp: #include <bits/stdc++.h> struct myclass {}; template <typename T, typename U> std::ostream& operator<< (std::ostream &os, const std::pair<T, U> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; } namespace my { void operator<< (std::ostream os, myclass