https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115801
--- Comment #3 from TC <rs2740 at gmail dot com> --- (In reply to Nathaniel Shead from comment #2) > On looking further into it I believe this is ice-on-invalid. > > By https://eel.is/c++draft/temp.friend#2, within main.cpp the name ::Foo is > looked up as if the specialisation had been explicitly declared at its point > of instantiation. Are you saying that this paragraph requires a name lookup of ::Foo at the point of instantiation? I thought this paragraph is about how the instantiation affects future name lookup, as the note describes. The idea that I can't befriend an internal helper class without exporting it seems surprising.