I get this from my closest friends, so I'm not sure it really has to do with thinking similarly, or we just know each other really well. They've all taken tests and know stuff about type because I've gotten them all into it haha.
I do have this tendency to connect well with INTPs. Though I did marry one, and perhaps that way of thinking has just become familiar to me over the years.

Everyone expects us to gets into arguments because of Ti vs. Fi, saying they "clash". I do not believe functions "clash". People do. I find the way we think to even be complementary. He's always trying to see how things fit and perfecting this framework of thought he has, and I'm always wondering about things. I associate and see relations between ideas - sometimes more quickly than him, but I'm not caring so much whether they're valid. He will take time to ponder and sort it out more than me. While he works on understanding it - what makes it what it is, how it fits in with how he understands stuff... I'll be weighing its significance (Fi). Our ways of thinking just work out really well together.
And we know each other better than anyone. In different situations now I will notice the things that would stick out to him and what they might make him think about. And he says he does the same thing now with me haha.
Two of my dearest friends are ESFJs. I don't understand why this type gets such a bad rap.
They're like sisters to me. They're both smart - one actually studied computer programming for a while, although her passion is raising awareness about social injustice. She's currently traveling around the US with some non-profit doing presentations and engaging people and things like that. The other is going into the nursing field and is also heavy into missions trips and leading small groups in this campus ministry she's a part of. They were both bridesmaids at my wedding actually. We know each other well. I have inside jokes with each of them. Often we can look at each other and know what we're thinking. It's just because we're so close.
I think we do think similarly a bit - connecting on our shared Ne-Si. Wandering around with them can turn into something kind of whimsical and storybookish.
I am also close to two ESTPs, two ISFJs, an ESTJ... I've definitely connected well with this one ESFP I know. Maybe it's the Fi.
I do have a friend who is not as close who is a fellow ENFP. I relate to him a lot on many things - some of his struggles are familiar to me. But we don't have any magical mind reading moments like I have with my close friends. I just find I "get" him sometimes, but not necessarily in what I'd call a "deep" sense.
*shrugs*
EDIT: STORYTIME Tbh, the most magical "I see you, I get you" moment I had was with someone who was more a stranger to me. He didn't strike me as a Ne-dom or even Ne-aux, though. He was for sure Introverted. It's not like he didn't like people... I just thought he seemed like he took so much in, was internalizing it.
It was while I was in community college. He was in my stats class. I watched him as he watched people. One time as I was in line to buy some coffee I caught him having a conversation with the cashier girl. I could tell didn't really know each other, but she was talking quite a bit about her feelings about something that meant a lot to her - and he was genuinely curious. It was the first time I'd ever seen someone curious kind of in the same way I was curious about other people.
But the next time I saw him, we had a good conversation.
I said hello from where I was sitting. He kind of just looked at me knowingly. We ended up talking in this hilarious way in order to probe each other's mind and get at how the other person was thinking. It was so natural the way we both went about it. It's like what we did when around other people, but less hidden. He told me he had noticed I was so surrounded by others. But he noticed that oftentimes when I'm with a group, it's like I'm mostly observing the people around me and the way they interact, and then occasionally I'll join in - and then go back to observing, like it's just natural to do so and without anybody truly noticing.
Nobody, I repeat nobody, had ever noticed this before. I tried to articulate why I did this for him - how I loved to figure out how people think. Why did I know interact with so many people? - no matter who the person is, I feel there is always the possibility they could be a friend or something.
He apologized at this point, said that this may come across as intrusive.
I smiled knowingly this time. I highly doubted that anyone ever thought he was intrusive. "It's fine," I told him. "I get the feeling you're one of those people who others unknowingly tell their whole lives' stories to."
At this, he began to laugh. "You're more perceptive than I thought," he said.
We never met again. I will never forget the interaction.