The Flatten node is used to transform 3D objects into flat planes when ordered in the Composite node. That plane can then be moved arouned like any other drawing. Instead of intersecting with 2D layers, the 3D object will either be behind or in front.
When all objects are at the same distance (z value) from the camera, the order is based on the Composite ports. When elements are placed at different distances from the camera, the z axis value overrides the composite port ordering.