namespace A{ template<class T> struct B{ friend void C(){} }; template<class T> struct D:B<T>{ friend void E(T x){} }; } int main(){ C(); // CE E(0); // CE }