According to A. H. Saxton's biography of Barnum,
"P.T. Barnum: The Legend and the Man" (Columbia University, 1989:
pages 257-261), Twain not only personally knew Barnum, but had
a twenty year relationship with him.
It started in the 1870's when the religious, non-smoking,
non-drinking showman reluctantly asked the swearing,
smoking, drinking Twain to help publicize his shows.
Twain didn't feel this was in his "line" and refused.
Still, Barnum invited Twain to his famous mansion,
and Twain housed Barnum at his Hartford's Nook Farm.
They were friends.
Around 1874 Twain wrote a long "advertisement" about
a very real comet of that time causing the world
much concern. Twain said he and Barnum had leased the
comet and were arranging staterooms in its tail.
MT advised readers to contact PT for more details.
Barnum, of course, loved the "ad"---and the free publicity.
MT began admiring PT's career right after reading the
1869 edition of the showman's famous autobiography.
Barnum kept his friend abreast of his life by sending
him copies of each revised edition of the big book.
Throughout his life Barnum received "bushels" of
unsolicited letters from people seeking hand-outs
or offering to sell their curiosities. Around 1874
PT showed some of these letters to Twain, who saw
the potential for a fun and profitable work. MT urged
PT to save and forward these letters to him. PT did, for
several years. In 1876 a Rev. Powers wanted to use the
letters in an article but Barnum denied access to them,
saying he had to honor his word to Twain. For whatever
unknown reason, MT never did anything with the letters.
In 1878 PT begged his friend to spare 5-10 lines
promoting his circus. All he asked for was that
Twain publicly write what he had privately written
to Barnum some three years earlier: "...that the
greatest wonder about Barnum's show is how it is
possible to give so much for so little..."
Twain refused, and regarded these requests as a
Twain later made up for this breach of friendship
by casting Barnum as a minor character in
"The Stolen White Elephant."
PS: Elsewhere in Saxon's bio he says Barnum was so
well received as a lecturer that the Boston "Globe"
wrote in 1875 "...it is safe to say that as a humorist
he could soon make a reputation as a lecturer
second only to Mark Twain."