I don't think that casting from void* to A* will change address. Cating from B* to A* - yes it can, but not from void*.
I think in this case author is allocating memory with new [] and array allocation stores length in first 4 bytes, that's why it returns address with +4 offset.

Find content
Male