fork download
  1. template <typename T>
  2. class A;
  3.  
  4. template<typename T>
  5. bool operator==(const A<T>& a, const A<T>& b);
  6.  
  7. template <typename T>
  8. class A {
  9. int x;
  10. friend bool operator==<T>(const A<T>& a, const A<T>& b);
  11. };
  12.  
  13.  
  14. template <typename T>
  15. bool operator== (const A<T>& a, const A<T>& b) {
  16. return a.x == b.x;
  17. }
  18.  
  19. int main() {
  20. A<int> x, y;
  21. x == y;
  22. return 0;
  23. }
Success #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty