fork download
  1. class Y{
  2. template<class T>
  3. friend class X;
  4.  
  5. void a_private_func() const{}
  6. };
  7.  
  8. template<class T>
  9. class X{
  10. public:
  11. void f(Y const& y){ y.a_private_func(); }
  12. };
  13.  
  14. template<class T>
  15. class X<T*>{
  16. public:
  17. void g(Y const& y){ y.a_private_func(); }
  18. };
  19.  
  20. int main(){
  21. X<int> xi;
  22. X<int*> xpi;
  23. Y y;
  24. xi.f(y);
  25. xpi.g(y);
  26. }
Success #stdin #stdout 0s 2824KB
stdin
Standard input is empty
stdout
Standard output is empty