Once a divorce starts, a child who disagrees with the parents over custody or parenting time arrangements has a right to have a lawyer. (But the parents are responsible for paying for the child’s attorney in a custody case that does not involve juvenile court.)
Even if a child doesn’t have an attorney, the child’s wishes can be told to the judge. Sometimes the judge will talk to the child directly in the judge’s office, with only the lawyers (not the parents) in the room.
In deciding custody, a judge will seriously consider a child’s wishes only if the child is mature enough to make a thoughtful choice, perhaps around age 13 or older. The age in deciding if a child is mature enough always depends on how mature the particular child is.