Federer wins to put Switzerland in Cup final