The story found in the Yoga Vasistha is that of King Sikhidhwaja and his Queen Chudala. A brief summary from the same link -
KING SIKHIDHWAJA AND QUEEN CHUDALA — The royal couple lead an idyllic life and both pursue spiritual knowledge. Chudala practices self-inquiry and attains Self realization. Sikhidhwaja notices she appears unusually radiant, but when she explains Self realization, he dismisses her as a mere woman. — ASTRAL TRAVEL : Chudala keeps her wisdom to herself and learns the yogic powers of manifesting astral bodies and astral travel. (VIA.77-80). Vasishta explains how such powers are possible. Queen Chudala tries to share her knowledge with her husband, but Sikhidhwaja continues to simply dismiss her as being only a woman. (VIA.83)
THE PARABLE OF THE MISER KIRATA AND THE PHILOSOPHER’S STONE . In this interlude within the story of Sikhidhwaja and Chudala, Vasishta explains how one can learn something valuable despite seeking trifles. The miser is searching for a lost cowry shell when he discovers the Philosopher’s Stone. (VIA.83.16-24)
KING SIKHIDHWAJA THE HERMIT; CHUDALA AS THE BRAHMIN BOY KUMBHA — Thinking asceticism is the way to attain enlightenment, King Sikhidwaja abandons his kingdom to become a hermit. Queen Chudala, knowing she has to allow her husband to learn in his own lessons, remains home to govern the country in his name, periodically using her powers to astral travel and check on how her husband is faring. She assumes the form of a brahmin boy, Kumbha, who becomes the hermit-king’s spiritual teacher and questions whether the hermit is progressing towards his goal of liberation.(VIA.84-87)
THE RICH MAN WHO FAILED TO GRASP THE REAL PHILOSOPHER’S STONE — Kumbha (Chudala) tells her hermit-king husband a parable about a rich man who obtains the Philosopher’s Stone (chinthamani). (VIA.88, 90)
A FOOLISH ELEPHANT TWICE CAPTURED — This is also told by Kumbha (Chudala) to teach the hermit-king. (VIA.89, 91)
SIKHIDHWAJA & CHUDALA (KUMBA) CONTINUED — The king burns all his hermit possessions in an attempt at complete renunciation, and Kumbha (Chudala) explains the real meaning of renunciation and reality, and that God and creation are the same consciousness — THE KING ATTAINS SAMADHI : the king attains enlightenment and gives up his need to live as an ascetic. (VIA.92-103) — A MARRIED COUPLE AGAIN : Sikhidhwaja and Kumba (Chudala) wander the world together and the queen desires to make love with her husband. The queen, as the boy Kumbha, tells the king that a curse by sage Durvasa makes him become female each night. It is in this form that they are married. (VIA.104-106) — CHUDALA TESTS SIKHIDHWAJA by making a false Indra appear as if making love to her, he passes the test, Chudala reveals her true form to her husband, and they are reunited. (VIA.108-110)