Signatures of a jet cocoon in early spectra of a supernova associated with a γ-ray burst