On the nature of Type IIn/Ia–CSM supernovae: optical and near-infrared spectra of SN 2012ca and SN 2013dn