// Overloaded + operator
#include <iostream>
using namespace std;

class OpClass
{
private:
  int x;
public:
  OpClass() = default;
  OpClass(int val) : x{val} {}

  OpClass operator+(OpClass r)
  { OpClass sum;
    sum.x = this->x + r.x;
    return sum; // return summed value
  }

  int getX()
  { return x;}
};

int main()
{
  OpClass a{1}, b{2}, c{0};
  cout << a.getX() << endl;
  cout << b.getX() << endl;
  cout << c.getX() << endl;

  c = a + b;
  cout << c.getX() << endl;
  
  return 0;
}    
