Compounds containing ammonium groups