No matter how well the female is treated, the males are still ground up or suffocated because they are considered worthless. Also, laying eggs depletes their bodies nutrients, and vegans will usually feed them back to the hens to help them regain some of what they've lost.
Since this was posted in the vegan forum, I'm going to answer as a vegan and say no, it's never okay to eat them. Once you start using them for food, you've changed them from a pet into a commodity.