https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87616
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Michael Gorbovitski from comment #2) > Slightly simplified test case (no need for double-argument template): here is one which is valid C++98 which shows even GCC 4.1.2 has the same ICE struct foo{}; template <class A> struct friender { typedef foo cls; }; class bar { template <class X> friend class friender<X>::cls; int hidden; }; int main() { bar b; } ---- CUT ---- Oh and clang does not support it fully either, it just turns off the access checking for bar.