fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. public:
  7. friend istream& operator>>(istream&, A&);
  8. friend ostream& operator<<(ostream&, const A&);
  9.  
  10. private:
  11. int x;
  12. };
  13.  
  14. istream& operator>>(istream& i, A& a)
  15. {
  16. return i >> a.x;
  17. }
  18.  
  19. ostream& operator<<(ostream& o, const A& a)
  20. {
  21. return o << a.x;
  22. }
  23.  
  24. int main()
  25. {
  26. A a;
  27. cin >> a;
  28. cout << a;
  29. return 0;
  30. }
Success #stdin #stdout 0s 2900KB
stdin
1111111
stdout
1111111