Your brain instinctively imitates the mental processes of people around you, i.e. mental processes are contagious. If your friend is happy, they will also make you happy. Although you can't read your friend's mind, you can deduce their thoughts from their actions which allows you to imitate their thoughts. Your brain is effectively reverse engineering other people's mental processes. However, you may inadvertently imitate undesirable thought processes.

For example, in trying to understand why someone is depressed, you may unconsciously imitate his thought processes leading to their depressed state. This should not give you any lasting depressing thoughts, assuming that you rarely meet depressed people. However, if you are frequently surrounded by depressed people, they are effectively training your brain to be depressed. Eventually, you will no longer need to imitate the depressing thought processes, as they have now become hardwired in your brain, i.e. they are now your habits. It's like converting software (that is easily changed) into hardware (that is difficult to change).

To take advantage of your brain's tendency to imitate other people's mental processes, you may:
  • Increase your awareness of successful and positive people, e.g:
    • make friends with people who are funny, happy, intelligent etc.
    • read biographies of successful people.
  • Imagine that right now, you are the person you ultimately want to become in the future.
  • If you really have to sympathise with people who are afflicted with negative thoughts,
    • focus on how they can avoid or overcome their affliction, rather than solely on why they are afflicted
    • monitor your own thoughts (which you should be always doing) and keep yourself detached from any negative thoughts
Why our brains might have evolved such an ability:
  • To empathise with other people, so that we can develop productive relationships with each other.
  • To learn skills and behaviours of people we admire, so that we contribute to progressively raising the standards of human beings.
  • To predict how other people may react to our actions, which is useful for making decisions affecting other people.