https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65152
--- Comment #2 from bugger_gcc at interia dot pl --- This is not what is specified, because C++11 7.3.1.2/3 states that such friend functions can't be found by name lookup unless it's ADL. Note that the friend 'test' incorrectly hides the global 'test' only if there are at least 2 friends with that name defined. With only one friend 'test' the code is compiled correctly. Also, Clang and ICC compile the code with the expected result.