I need help to overload the operator + in the format (z + obj2).

I have done it in two formats where 'n' becomes the sum of two objects and 'z' is z (scalar variable/constant/expression).

1. n = obj2 + obj 1 (done)

---> declaration

double operator+(const product&);

----> definition

// Overloading the operator+ (productObj2 + productObj1)

double product:perator +(const product & rhs)

{

return (*this).productCost + rhs.productCost ;

}

2. n = obj2 + z (scalar variable/constant/expression) (done)

---> declaration

double operator+(const double&)----> definition

----> definition

double product:perator +(const double & rhs)

{

cout << "The operator+ (productObj2 + z) function ran." << endl;

return (*this).productCost + rhs ;

}

3. n = z + obj2 <---------- Need help/tips/comments to overload operator +

<Need help/tips/comments to overload operator + in the above format>

Thanks.