The mass of the ice cube is roughly the same as that of the liquid it pushes aside while floating in the glass. When the cube melts, the surrounding liquid can move into the space it filled.
If the glass contains only ice and water, it will not overflow because the amount of extra water will be equal to that previously displaced by the cube(s).
Diluted soda is slightly denser than water due to its sugar content. The water from the ice cube would therefore fill a larger volume than what it displaced and so, in this case, the melting ice might push some liquid out of the glass.
Plus, take a look at: