It was the french who did the hitting, not the british.
Same question still applies. How did the British know who the other party was? If they identified the contact before impact, why didn't they avoid the collision? If they identified them after the impact, why didn't they use their underwater communication gear and signal them?
I'm going to infer that the British sub didn't know either, but that the RN and French Navy put two and two together after the subs both made their reports.