I might add that clan++ shows the same behavior, I've just filed a bug with llvm upstream [1].
Some more details: If the enum is replaced by a struct then compilation fails in both, in c++03 and in c++11 mode. I suspect now that it is assumed to be permissible by the standard that white spaces occur before (ans also after?) the "::" in the specification of fully qualified names and that this might actually be a bug in the C++ standard itself since it ignores the here presented case when a function in the global name space with a non-trivial return type must be specified withing another scope (like here in the friend declaration). But I don't know the standard well enough to be sure. Best, Gert [1] https://llvm.org/bugs/show_bug.cgi?id=28422