I have class Item and Item items and int q. I'm trying to make a function to overload+=. Would I need a friend function, or does it have to be member?
The statement in main program is
items+=q;
in class Item header file:
friend Item operator+=(const Item&, int&);
in class Item cpp file:
Item operator+=(const Item& items, int& q)
{
items+=q;
return items;
}
And so compiler says no match for "+="