类中有对象成员的复制跟赋值

类中有对象成员的复制和赋值
#include<iostream>
using namespace std;

class A
{
public:
A(){m_a= 10;cout<<"A()"<<endl;}
A(const A&){cout<<"A copy constructor"<<endl;}
A operator=(const A&){cout<<"A ="<<endl; return *this;}
private:
int m_a;
};

class B
{
public:
B(){m_b = 20; cout<<"B()"<<endl;}
B(const B&){cout<<"B copy constructor"<<endl;}
B operator=(const A&){cout<<"B ="<<endl; return *this;}
private:
int m_b;
A a;
};
 
int main()
{
cout<<"1"<<"  "<<endl;
B b;
cout<<"2"<<"  "<<endl;
B b2 = b;
cout<<"3"<<"  "<<endl;
B b3;
cout<<"4"<<"  "<<endl;
b3 =b;
}


输出结果是:
1
A()
B()
2
A()
B copy constructor
3
A()
B()
4
A =
A copy constructor


2和3不大明白,望解释
------解决方案--------------------
修改两个地方,应该能让构造过程更清晰点:
class B
{
public:
B(){m_b = 20; cout<<"B()"<<endl;}
B(const B& b):a(b.a){cout<<"B copy constructor"<<endl;}//使用初始化列表
B operator=(const B&){cout<<"B ="<<endl; return *this;}//参数改为B&
private:
int m_b;
A a;
};

------解决方案--------------------
《深入c++对象模型》有编译器生成构造函数,复制构造函数,析构函数的具体行为。但是只是参考,具体要看编译器。