I was at a party recently when this topic came up and very quickly all the dads in the vicinity were huddled together commiserating about it.
Some dads said that their child refused to hug them, wanted "Mommy to do it," or screamed for mom when they were hurt. I heard stories of kids running the opposite direction when dad came in the door (even if the child was excited for his arrival), and fathers trying to sneak cuddles while their kids were absorbed in TV or even asleep. Kids can really hurt our feelings when they outright prefer one parent over the other. It can even lead us to question our skill as a parent or the strength of the bond between us.
Asking for one parent is healthy.
But being second fiddle in your house is not a reflection of how much your child loves or needs you – in fact it's a natural and healthy part of the attachment process. Babies come equipped with a drive to seek out, find comfort from, and stay close to caregivers. One of the ways they practice this system is to attach to one person and use that person as the ultimate source of trust and support – sometimes to the exclusion of the other parent. And this issue isn't exclusive to dads, because many children go through phases of asking for one parent over the other, and the favoritism shifts back and forth. It happens for different reasons (the novelty of the parent who isn't around as much, the comfort of the more familiar parent, or the need to identify with one parent at a particular developmental phase).
How to handle the favortism
When you're the passed-over parent, try to let it roll off you (easier said than done, I know), because the more you pursue and demand attention, the more some children decide to run the other direction. Avoid this pursuer-distancer dynamic by letting your child choose which parent to go to freely.
Do a quick survey of your quality time with your child: Have you set aside some one-on-one time together? Sometimes mom (if she's the one home more) gets the alone time, while dad gets family time but not as much direct bonding. If your time is limited, try to pick a special activity that is dad's and dad's alone – weekend swim lessons, bedtime routines, or just simple games that make child and father feel like they have "their thing" together.
If you're the parent who feels cast aside, try to take the long view. Most likely, a time will come when you'll feel like the special one again.