combining multiple render layers

With my node setup right now, I have an effect applied to an object (a glow) and the rest of the scene is put in the background with an alpha over node. This only works if there is no objects in front of it.
Otherwise, it always remains in the foreground no matter what. So is there a way that blender can only render the parts of the mesh that are visible when all layers are visible?

Would you like me to post a blend file, node setup, or render? It might help you understand exactly what I am asking about…

If you only want the visible parts of an object on any particular render layer to be rendered then enable the “AllZ” button for that render layer on the render tab.

In the render layer that has the glow object, Ctrl-Click all of the other layers with objects. This will make their location a part of the alpha mask of the glow-object render layer.