I don't know how you can be true friends unless maybe you really had no deep feelings for her or him in the first place. Otherwise, there would always be a time, a situation, a moment when you or s/he would think, "I wonder if...".
I guess if I felt I really picked the wrong person because of something I was delusional about, I might understand.
When you choose as wisely as you are able, and you believe, hope, dream, and think of what life will be like when retired with her/him, it's tough to be friends when it ends, no matter the reason.
I'm thinking that being civil when you have to be around them for as little time as absolutely necessary, is the maximum anyone could expect.
I will probably run the other way if I ever see my ex in or around where I am. I can't run, so I'll have to walk as quickly as I can. I will not even entertain the idea of being close enough to see her. That's probably hundred yards or more. I wouldn't hold my bowels till I could get to her gravesite. She isn't worth the discomfort.
I'll applaud @Haiku
. I don't even remotely understand how that could be done.