This question has already an answer: Some IXD2 U-Boats were sunk in the Pacific by american fleet boats
However, the truth is that they were caught by surprise thanks to decryption of german transmissions, etc.
Probably the truth is simply what Zilch already said: Whoever sees and shoots first