See J. S. Mill's treatise on Utilitarianism (chap. iii. passim): where, however, the argument is not easy to follow, from a confusion between three different objects of inquiry: (1) the actual effect of sympathy in inducing conformity to the rules of Utilitarian ethics, (2) the effect in this direction which it is likely to have in the future, (3) the value of sympathetic pleasures and pains as estimated by an enlightened Egoist. The first and third of these questions Mill did not clearly separate, owing to his psychological doctrine that each one's own pleasure is the sole object of his desires. But if my refutation of this doctrine (Book I chap. iv. §3) is valid, we have to distinguish two ways in which sympathy operates: it generates sympathetic pleasures and pains, which have to be taken into account in the calculations of Egoistic Hedonism; but it also may cause impulses to altruistic action, of which the force is quite out of proportion to the sympathetic pleasure (or relief from pain) which such action seems likely to secure to the agent. So that even if the average man ever should reach such a pitch of sympathetic development, as never to feel prompted to sacrifice the general good to his own, still this will not prove that it is egoistically reasonable for him to behave in this way.

ME Book 4 Chapter 6 Section 3