I am not sure I follow.
B is the object you want to filter its events, and you know that, since you call b->installEventFilter().
In A, the eventFileter() method takes a parmeter with the object that currently triggered the incoming event, so you know its B (in A).

So what exactly is missing for you?