Ted and Lily both understand each other more than the others of the group do, besides Lily and Marshall. I think the reason for this because they are both parallel of each others in terms of dreams.

Ted doesn't have any long lasting relationships. He constantly stalls in starting a family and finding someone. However he is successful in his professional life. He becomes an architect and fulfils his dream of designing a building in NYC.

Lily doesn't have an way to continue her dream of being an artist or art collector. She spends years just stuck in a job that she doesn't really love and desperate to fulfil her dreams. On the flip side Lily becomes a mother, has a loving stable relationship.

That is why the can have so many real conversations with each other. They have no romance between them and they know exactly how the other one is feeling. They have also been friends for years before the show has even started.