The object you want to use as a mask must be placed in front of the other element. Select both objects, right click, and choose “Make Clipping Mask”.