fork(1) download
  1. #include <iostream>
  2.  
  3. template <typename> class test;
  4.  
  5. template <>
  6. class test<int> {
  7. int y;
  8. public:
  9. test(int k) : y(k) {}
  10. friend std::ostream& operator<<(std::ostream& os, const test& t);
  11. };
  12.  
  13. std::ostream& operator<< (std::ostream& os, const test<int>& t)
  14. {
  15. return os << t.y;
  16. }
  17.  
  18. int main()
  19. {
  20. test<int> a(42);
  21. std::cout << a << std::endl;
  22. }
  23.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
42