Context. Hydrides of the most abundant heavier elements are fundamental molecules in cosmic chemistry. Some of them trace gas irradiated by UV or X-rays.
Aims. We explore the abundances of major hydrides in W3 IRS5, a prototypical region of high-mass star formation.
Methods. W3 IRS5 was observed by HIFI on the Herschel Space Observatory with deep integration (similar or equal to 2500 s) in 8 spectral regions.
Results. The target lines including CH, NH, H3O+, and the new molecules SH+, H2O+, and OH+ are detected. The H2O+ and OH+ J = 1-0 lines are found mostly in absorption, but also appear to exhibit weak emission (P-Cyg-like). Emission requires high density, thus originates most likely near the protostar. This is corroborated by the absence of line shifts relative to the young stellar object (YSO). In addition, H2O+ and OH+ also contain strong absorption components at a velocity shifted relative to W3 IRS5, which are attributed to foreground clouds.
Conclusions. The molecular column densities derived from observations correlate well with the predictions of a model that assumes the main emission region is in outflow walls, heated and irradiated by protostellar UV radiation.