The answer is the Ego. Freud believed that the job of the ego is to satisfy the demands of the Id (pleasure principle) without offending the Superego (sense of right and wrong). In this case, giving food to the needy gives us pleasure, and we know it is the right thing to do.
Hope this helps!