The correct option is
C overhearing
In the sentence, the word 'speaking' indicates that the action 'They' are carrying out is ongoing and since the subject's action depends on the action of 'they', the subject's action must also be ongoing.
Option A is incorrect. 'to overhear' does not indicate that the action is ongoing and thus, it cannot be the answer.
Option B is correct. 'overhearing' indicates that the action is ongoing and thus, it is the correct answer.
Option C is incorrect. 'overhear' is a complete verb. According to the rules of usage, there can be only one main verb in a clause and so, using 'overhear' will make the sentence grammatically incorrect.
Option D is incorrect. In 'but to overhear', 'but' is a conjunction and 'to overhear' is an infinitive and not a complete verb. Since 'but' is a conjunction, 'to overhear' marks the beginning of a new clause and this new clause lacks a verb. A clause has to have a verb and so, using option D will make the sentence grammatically incorrect.