fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class T>
  5. class Foo
  6. {
  7. template <class> friend bool operator== (const Foo&, T);
  8. };
  9.  
  10. template <class T>
  11. bool operator==(const Foo<T>&, T)
  12. {
  13. return true;
  14. }
  15.  
  16. int main()
  17. {
  18. cout<<(Foo<int>() == 2);
  19. return 0;
  20. }
Success #stdin #stdout 0s 15224KB
stdin
Standard input is empty
stdout
1