Which Pokémon games can I use to trade Pokémon with the Sun and Moon versions?
Solution 1:
You can't trade Pokémon to/from Pokémon Sun and Moon with any other games.
Eventually, however, you will be able to transfer Pokémon to Sun or Moon from ORAS, XY, BW, BW2, and the virtual console RBY versions.
See here:
Pokemon Sun and Moon are not compatible with the Generation 6 series of games: Pokemon X and Y; and Pokemon Omega Ruby and Alpha Sapphire. You won't be able to trade or battle between these games and Pokemon Sun and Moon, therefore you'll need a special app called the Pokemon Bank to transfer your Pokemon.
Transporting Pokemon into Sun and Moon from Pokemon White, White 2, Black, Black 2 and the Virtual Console games Pokemon Red, Blue, and Yellow is also possible with Poke Transporter, which comes bundled with Pokemon Bank.
However, Pokémon Bank and Poké Transporter won't be available for Pokémon Sun or Moon until January 2017.