It's probably doable, but it won't - or shouldn't - happen.
A principle of game design is not to punish the player for something they have no control over. Its like game design 101, and there's really nothing a player could do to protect themselves against misidentification by a friendly, short of never ever surfacing - which is what people would start doing.
I would **** a brick if I lost an entire career in 1943 because I got obliterated by a friendly BB who didn't recognise me. It may be realistic, but there's a certain point beyond which realism stops being fun.
__________________
|