Molecular ions in comet tails