First, the bool operator==() in the class A should be virtual
.
Like:
class A
{
public:
virtual bool operator==(const A& other) { ... }
};
That means that even if you refer to a class A, it can be treated as B, if that is what it really is.
Second, you make a copy of your B instances to A instances. That is a conversion you do not want. Instead you should pass them "by reference". Like this:
void process(A& _b1,A& _b2)
{
...
}
That way, when they are actually processed, they still refer to the original objects, which are of class B.