#include<iostream>
using namespace std;
class mango
{
public:
    int qnt;
    mango(int x = 0)
    {
        qnt = x;
    }
    mango operator+(const int a)
    {
        mango temp;
        temp.qnt = a + this->qnt;
        return temp;
    }
};
int main()
{
    mango obj(5);
    obj = obj + 5;
    cout<<obj.qnt<<endl; // shows 10;
    return 0;
}
Now I want to overload object = constant_int + object, that is
obj = 5 + obj;
I want to keep constant integer on the left hand side and store the sum in the object. How to do that?
 
    