Two-hadron interference fragmentation functions. I. General formalism