https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87616
--- Comment #2 from Michael Gorbovitski <mickg at mickg dot net> --- Slightly simplified test case (no need for double-argument template): struct foo{}; template <class A> struct friender { using cls=foo; }; class bar { template <class X> friend class friender<X>::cls; int hidden; }; int main() { bar b; }