Object between two objects when using render layers

Hello,

I have an object A on render layer 1. On render layer 2 I have an object B behind object A and an object C in front of object A.

When I now try to composite the render layers, I only know how to either have object A in front of both C and B or have C and B both in front of A using the “Alpha Over” node.

Question is, how do I composite it correctly so that B is behind A and C is in front of A? Please note that I wish the render layers to remain the same (no moving object B/C to another render layer).

Thanks.