Great Minds Think Alike

What does the expression “great minds think alike” mean?

Definition: I just had exactly the same idea as you.

Example: “Maybe we could order a pizza instead of cooking.” —”Great minds think alike!”