How to substitute in baking so the result is both egg- and gluten-free?
AFAIK, (which isn't much) there is no one good substitute for eggs in baking. This is because the egg can be there for one or more of several reasons. This includes as a flavorant, emulsifier, moisturizer and leavener. So, I'll address each of these separately.

Flavor - I have yet to find an ingredient or ester I can easily produce to replicate the very eggy taste of eggs. You're best bet is likely a commercial substitute (which also may solve the other issues below).

Emulsification - (Soy) Lecithin. Period. Probably about a tablespoon per egg yolk replaced. If this leaves your recipe too dry...

Moisturizer - Applesauce. Period. The high pectin is an emulsifier as well, and it will moisturize without imparting strong flavor. Alternatively, add more liquid (which see below for gluten notes).

Leavening - Baking powder may do the job here. You may also want to use buttermilk alongside it. If that doesn't work, Xanthan Gum may be worth trying alongside the BP or buttermilk. Use VERY LITTLE XG, it will thicken it up nicely. However...

Gluten. Its what makes bread so bready. As long as what you're making isn't bread (if you need to sub egg out for a whole egg in bread, I got nothin') you can substitute out any flour that's not wheat, rye, or barley based. If you're friend has Celiac Disease, simply not using those flours or any byproducts in a from-scratch recipe should be fine. If your friend has IBS and it's a FODMAP issue, there's quite a few more landmines to avoid, and I recommend asking a nutritionist for specific advice/check a recipe. If it's an allergy to wheat, ask for a list of known allergens from your friend. Best thing to do is have your friend forward the specific diagnosis that their doctor/nutritionist gave them; I'm sure they wouldn't mind so that you can safely cook for them.

It's not quite as easy as just using a different flour though. You'll probably want to use less flour overall, and a mix of different flours to go toward a specific taste and feel.

TLDR; Substitutions are hard. Use rice flour and applesauce, I guess.

Experiment! You can report back with your findings...