When you all are chatting one day, just randomly bring up food. Or be like... mmmm I'm totally craving cake right now, and then ramble on about yummy cakes for a bit and whatever kind you like, and maybe they'll mention their favorite, or you can work in asking what theirs is without it sounding too obvious.
Go to the store and buy your favorite candy, take it home and start eating it with them. Then say "This is my favorite flavor" and eventually lead that up to "What's your favorite flavor?" Or rather than asking, UNOBVIOUSLY try to get them to just name their favorite without you having to ask.
I would think that is virtually impossible. You would definitely be tipping them off. You are going to have to go on what you already know about them and ask people who know them very well what they like if you don't want to ruin the surprise.
I would (if I were you) start a conversation, and then when you are laughing together over something funny, bring up the question like "for future references, what kind of cake do you like?" That is what I'd do. ;) :)