In compositor 2 images overlay each other I have two objects on two different layers. Gem and surface plane. I also use HDRI and because of that I can't disable "Use environment" option in Render Layers menu. I followed this tutorial in goal to achive glare effect on gem stoune. But in the compositor I either loose surface or loose gem stone. What nodes should I use to preserve either surface mesh and gem.
Use a Color > Alpha Over node to combine both layers, then use the Diamond layer Alpha channel map as mixing factor.

Make sure you created a proper alpha map in the Gem layer so it can be properly combined.