I have the following simplified code:
template <class T> class A { public: template <class U> static U foo(T* p) { p; return U(); } }; class B { /*template <class T> template <class U> friend U A<T>::foo<U>(T*);*/ friend B A<B>::foo<B>(B*); B() {} public: }; ... A<B>::foo<B>(nullptr);
And it works very well. But what I failed to do is commented out:
/*template <class T> template <class U> friend U A<T>::foo<U>(T*);*/
I don't know what syntax I have to use to make it work. Therefore, I need to generalize my declaration of friends to all possible types. I tried several syntax options but did not succeed. Can someone tell me what should I write instead of my commented code for it to work? Thanks!
ixSci source share