Hiding part of the object
Give object A an Holdout material.

That will only work if "Transparent" is enabled in Render Properties/Film, so in case you want a solid background, you'll need to add it in compositing.