fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class I
  6. {
  7. int i;
  8. public:
  9. I(int i = 0):i(i){}
  10. operator int() const { return i; }
  11. };
  12.  
  13. I operator >> (const I& a, I& b)
  14. {
  15. I c = b;
  16. b = a;
  17. return c;
  18. }
  19.  
  20. int main(int argc, const char * argv[])
  21. {
  22. I a(3), b(4), c(5);
  23. a >> b >> c;
  24. cout << a << " " << b << " " << c << endl;
  25. }
  26.  
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
3  3  4