The King's Dream seems to be a prominent theme in the ancient world. For example, in the book of Daniel (in biblical literature), the troubling dreams of the kings are announced, though no details are given for the sake of the literature. The point is that the king is "testing" his subjects, and will reward the interpreter that both knows what the dream is and can interpret it. Such a test, though, is a concocted fantasy of the literature; the main takeaway for us is that royal dreams are shared. (For more on this point, see M. H. Henze 1999 The Madness of King Nebuchadnezzar, Brill.)
A similar trial is done in Herodotus' Histories, in which the Lydian king Croesus asks Greek oracles about a dream, and only Delphi both knows what the dream is and correctly interprets it. Again, the secrecy and test are fictional, but dreams being shared fits a larger pattern of dream reports in the Ancient Near East.
The standard reference for the so-called "dream reports" is Oppenheim's 1956 Interpretation of Dreams in the Ancient Near East, which was followed up well by Robert Gnuse's 1996 Dreams and Dream Reports in the Writings of Josephus, which is online if you want a fuller history.
As for Oppenheim, I quote K. Bulkley, who summarizes the main point better than I could:
Oppenheim claims that almost all of these dream accounts have a primarily literary function, serving as plot devices used deliberately by the authors. Consequently, Oppenheim asserts that psychological inquiry into these dreams is vain, for it is highly unlikely, and impossible to prove, that these reports are based on genuine dream experiences (Oppenheim 1956, 185).
Bulkley then goes on, in fact, to examine Gilgamesh. She starts from where Oppenheim leaves off—that Gilgamesh fits this pattern—but then notes the differences, chiefly by observing that "all the dreams in Gilgamesh) are evil dreams—frightening, confusing nightmares of struggle, violence, and death" (161). This type of dream, like Nebuchadnezzar's in Daniel, "require interpretation," and thus are not out of bounds to fall into the type that would be communicated as Gilgamesh does with Ninsun.
K. Bulkey 1993, "The Evil Dreams of Gilgamesh: An Intersciplinary Approach to Dreams in Mythological Texts," in C. Schreier Rupprecht ed. The Dream and the Text: Essays on Literature and Language, pp. 159-199. Albany.