Below is the code I am trying to figure out with the copy constructor and = operator overloading. Below I have commented line with the copy constructor ambguity.
Code:
using namespace std;
class A{
        int a;
    public:
        A(int x = 0){a=x; cout<<"Called ctor for"<<a<<endl;}
        A(const A &obj){cout<<"Copy Ctor called"<<endl;a = obj.a;}
        void set(int x){a=x;}
        int get(){return a;}
        A operator+(const A &);
        A operator*(const A &);
        void operator=(const A &);
};
A A::operator +(const A &obj){
    cout<<"Inside + operator"<<endl;
    return a + obj.a;
}
A A::operator *(const A &obj){
    cout<<"Inside * operator"<<endl;
    return a * obj.a;
}
void A::operator =(const A &obj){
    a = obj.a;
    cout<<"= operator is called"<<endl;
}
int main(){
    A a(10), b(11);
    A c = a + b;    // Why isn't copy ctor is called for this statement?
    c = a+b;
    cout<<"Value: "<<c.get()<<endl;
    cout<<"Value: "<<(a*b).get()<<endl;
    return 0;
}
Output:
Called ctor for10
Called ctor for11
Inside + operator
Called ctor for21  //Just ctor of the temp object from the operator+ () called.
Inside + operator
Called ctor for21
= operator is called
Value: 21
Inside * operator
Called ctor for110
Value: 110
Please explain why copy constructor is not being called in this case?
 
    