how to cut out certain part of the object by compositing

I want cut out the lower overlapping part of the cube with the sphere so that the backgound image is shown through.
please check attatched .blend.


untitled.blend (677 KB)

Use an ID pass of the sphere as a mask or matte shape, set that as an alpha channel and add it to the cube image alpha.

ID pass works!
I found Blender wiki ID pass manual.

Thank you

Only drawback is that the ID pass isn’t anti aliased from memory. So it can have a rough edge.

recent build from has anti aliase check box for ID pass node works fine.