C++ inheritance assignment