https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113748
--- Comment #2 from Jason Liam <jlame646 at gmail dot com> --- (In reply to Andrew Pinski from comment #1) > >This should be valid because `friend class C;` befriend a global class named > >`C`. > > > Hmm, see PR 21498 ... This is ill-formed as explained here:https://stackoverflow.com/questions/77932976/why-is-a-type-alias-not-allowed-to-be-a-friend-class-name-in-c/77932987#77932987 So gcc is correct here.