Upvote:7
One answer is the battle of Koeniggratz, against Bismarck's Prussia, which Austria-Hungary lost.
Bismarck looked for allies in his war against Austria-Hungary, and found a ready "taker" in Italy, who wanted Venezia, and had previously been allied with France (and gotten Lombardy out of the bargain). The Italian participation occupied enough of the Austrian army to enable Prussia to beat Austria-Hungary further north.
Austria-Hungary then sued for peace, with France's Napoleon III as mediator. Up to that time, France had seen the Hapsburgs as their main rival in European affairs, and therefore mediated against Austria-Hungary, and in favor of Italy. (Austria-Hungary surrendered Venetia to France, who returned it to the newly-emerging Italian state, a move that was supported by Prussia.)