http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49254
Summary: cannot declare member template as friend of class template Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@gcc.gnu.org template<typename T> class outer { template<typename U> struct inner { }; template<typename U> friend class outer; template<typename U> template<typename> friend class outer<U>::inner; public: outer() { } }; template class outer<void>; template class outer<void>::inner<int>; Gives this error: priv2.cc: In instantiation of 'outer<void>': priv2.cc:21:16: instantiated from here priv2.cc:5:14: error: 'template<class T> template<class U> struct outer<T>::inner' is private priv2.cc:5:14: error: within this context I don't think the friend declaration is actually needed to allow inner<U> to access outer<T>, but I think it is valid and should be accepted. Comeau and Clang accept it.