In order to make it work, you need to bring the operator=
into B
's scope:
class B : public A
{
public:
using A::operator=;
};
According to the standard [class.copy.assign/8]:
Because a copy/move assignment operator is implicitly declared for a
class if not declared by the user, a base class copy/move assignment
operator is always hidden by the corresponding assignment operator of
a derived class (16.5.3).
So, because the B::operator=
has been implicitly declared, it has hidden A::operator=
, which requires you to bring it into scope if you want to use it.
Further quote from the standard [over.ass/1]
An assignment operator shall be implemented by a non-static member
function with exactly one parameter. Because a copy assignment
operator operator= is implicitly declared for a class if not declared
by the user (15.8), a base class assignment operator is always hidden
by the copy assignment operator of the derived class.
Emphasis is mine.