Thinking the same is a part of an evolutionary long developed thing.
Humans, being tribal and staying close for a certain period have even physical processes happening in the same time.
As long as somebody sharing same experience during long time, no surprise that same thoughts (even not simple ones) are coming instantly together.
Regarding thoughts delivery from one brain to another, there are undergoing researches and some results.
Still even sharing a bit of information about subscription system
here is and enormous effort.
Researchers demonstrate brain-to-brain communication between humans by integrating existing technologies
spectrum.ieee.org