http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59815
--- Comment #1 from Paul Pluzhnikov <ppluzhnikov at google dot com> --- Slightly more reduced test: namespace foo { template < typename > class A { template < typename > friend class Outer; }; A<int> a; // comment out -> bug goes away. template < typename > class Outer; } using foo::Outer;