Do we have a word or phrase for this? For example, we could have two good friends: Person A and Person B. In a conversation, after a certain phrase is said, both say the same thing at once, signifying that they both thought about the same thing/shared the same feelings. It would essentially be a way of "knowing what each other is thinking".
There is no word or phrase for two persons accidentally saying the same thing at the same time. In the U.S., however, there is a children's game that is initiated when that happens (see jinx)