As an increasing number of young South Africans reveal that their gender identities differ from their sex at birth, schools are learning about the challenges these students face, writes the BBC's Mohammed Allie from Cape Town.
Three years ago, Alex* transitioned from a boy to a girl. Now eight years old, she wears her blonde hair long and feels at ease among her classmates at a primary school in a leafy Cape Town suburb.
"My friends are really nice," she says, even if some children in another class "don't really understand and act a bit mean".
Alex's mother Jennifer* says the family was initially advised by a psychologist against allowing Alex to explore her female identity, and was urged instead to reinforce the male gender.
"So we cut her hair and forced her to be a boy, but that turned out to be awful," Jennifer says. "She was affected badly - there was a noticeable decline in her sense of self."
Matters only improved after the family - acting on the advice of another mental-health professional - allowed Alex to dress as she wished.
"Legally we haven't changed the gender marker," Jennifer says, "but she started wearing dresses to school and they were OK with that."
South Africa has been getting better at understanding the needs of transgender students, backed by a constitution that is widely recognised as one of the most liberal in the world.
The country remains the only one in Africa that legally prohibits unfair discrimination on the grounds of sexual orientation, guaranteeing equality for all.
The risks of 'coming out'
Despite the legal framework, homophobia and discrimination still persist in South African society, more so in the majority black communities than among their white and mixed-race compatriots.
According to the Centre for Risk Analysis at the South African Institute of Race Relations (IRR), only half of black LGBT people are completely open about their sexuality.
The report says black LGBT people may be more reluctant to reveal their sexuality because they are "more likely to be victims of physical violence than those in other race groups".
The risks of "coming out" are particularly high for black people in rural areas.
According to the IRR, only 35% of LGBT people in Limpopo province are open about their sexuality - the lowest rate in the country.
At the other end of the scale is Western Cape province, where an estimated 70% of LGBT people are completely open about their sexuality - way above the national average of 57%.
The provincial capital, Cape Town, has developed a global reputation as a gay-friendly city, boosted by its annual Gay Pride festival.
According to Ron Addinall, a sexologist and social psychologist based at the University of Cape Town, schools in the area have led the way in understanding the needs of transgender students.
The number of transgender students who have gone public has also been rising dramatically, he says, thanks to growing awareness of what it means to be transgender.
Mr Addinall, who has been advising schools as well as parents and their transgender children on dealing with transitions, says many teachers told him they were initially unaware they had transgender students in their classes.
Some 20 schools in Cape Town have made provisions to accommodate the needs of transgender students, and more are following suit.
The measures include introducing single-gender toilets, as well as allowing students to use their new names and gender-neutral school uniforms.
At Westerford High, a school with a reputation for free thinking, principal Rob le Roux says the needs of a transgender student were accommodated by allowing a change in uniform, and in the pronouns used to address the student.
"The biggest change was in attitude," he says. "We had meetings with staff, parents and children to discuss how to deal with these types of requests."
While well-resourced suburban schools may have adjusted to the unique challenges faced by transgender students, Mr Addinall says the situation is not quite the same at township schools.
"I'm anxious about what is happening in the pre-urban and rural school environments.
"The concern is that there are many transgender children in those schools [that are] not getting the appropriate support and have to hide who they are."
Iranti, a media advocacy organisation that defends the rights of lesbians, transgender and intersex people, has highlighted the case of a seventh-grade transgender pupil at a Western Cape school who was mocked after the school refused to recognise him as a boy because he had been registered as a girl at birth.
And last year, a judge at an Equality Court in Limpopo ordered the provincial education department to pay 60,000 South African rand ($4,100; £3,300) in compensation to a transgender pupil who said her principal instructed other pupils to provoke her in the school toilets.
Mr Addinall says his work with schools depends on the co-operation of individual educators and principals.
"Things would be much better if we had a national policy that clearly stipulates how transgender learners should be supported and cared for," he says.
* Alex and Jennifer's names have been changed to protect their identities.