It's possible procedurally but you need a special setup:
- copy (reference) the base shape
- select original shape, right click in the modifier list, choose 'Make Reference'
- now you can add different modifiers to both objects (above the reference line in the modifier window), while still being able to modify the base shape
Now you can use object B to drive opacity of object A by using a distance map and object B as the distance object.
Of course, you need to make sure the resulting geometry produces a valid result.
Keep in mind that on an extruded object, you will see both the front and back side of the object. You may need an additional setup to make sure the back faces are invisible, for example by using MatIDs (which could be automatically assigned when using a Shell modifier for example).