class Z
{
public:
Z(){}
Z(int i) { data = i; }
void print() { std::cout << data; }
Z operator+ (Z& b);
private:
int data;
};
Z Z::operator + (Z& b)
{
Z result;
result.data = data + b.data;
return result;
}
int main()
{
Z a = 5;
Z b = a + a + a;
b.print();
}