cannot access namespace scope friend explicitly
问题 I had an issue today where ADL wasn't finding a static member function for a type defined inside a class. That is, in the below example, str(foo::Foo::Enum) isn't located via ADL without explicitly scoping it, foo::Foo::str(foo::Foo::Enum) namespace foo { struct Foo { enum Enum { FOO1, FOO2 }; static const char* str(Enum e); }; } foo::Foo::Enum e = foo::Foo::FOO1; const char* s = str(e); // ADL doesn't work I found this SO question, and as stated in the accepted answer, changing it to a