I have seen this story in the past in a Jewish book or two, and have heard the story and related ones about true friends, but that is not solid evidence that it started as such. The article relates the story as follows:
I tracked it down to Gesta Romanorum, which was a Latin book of old stories, probably composed no earlier than the 14th century. There, the story, Tale 129, is as follows:
OF REAL FRIENDSHIP.
A Certain king had an only son, whom he much loved. The young man was desirous of seeing the world and making friends for himself, and obtained his father's permission to this end. After an absence of seven years,f he returned, and his father, overjoyed at his arrival, asked what friends he had acquired. " Three," said the son ; " the first of whom I love more than myself; the second, equally with myself; and the third, little or nothing." " You say well," returned the father; " but it is a good thing to prove them before you stand in need of their assistance. Therefore kill a pig, put it into a sack, and go at night to the house of him whom you love best, and nay that you have accidentally killed a man, and if the body should bo found you will bo condemned to an ignominious death. Entreat him, if he ever loved you, to give his assistance in this extremity." The son did so; and the friend answered, "Since you have rashly destroyed a man, you must pay the penalty: for if the body were found in my house I should very likely be crucified. Now, because you were my friend, I will go with you to the cross, and bestow upon you three or four ells of cloth, to wrap your body in when you are dead." The youth, hearing this, went in much indignation to the second of his friends, and related the same story. He received him like the first, and said, " Do you believe me mad, that I should expose myself to such peril ? But, since I have called you my friend, I will accompany you to the cross, and console you as much as possible upon the way. The prince then went to the third, and said, " I am ashamed to address you, for I have never benefited you in any way: but, alas! I have accidentally slain a man, and must hide the body or perish." " My friend," answered the other, "I will readily do what you wish, and take the crime on myself; and, should it be necessary, I will be crucified for your sake." This man, therefore, proved that he was his friend.
The reference to crucifixion might make it a religious story, or else might make it just adapted to the language of the time.
But Gesta Romanorum takes this mashal and provides a very Christian nimshal:
My beloved, the king is God; the only son is any Christian. The first friend is the world ; and if it gives, in your necessity, two or three ells of cloth, it is much indeed. The second friend is your wife, and sons, and daughters; they will bewail you to your sepulchre, but soon forget you after you are laid there. The third friend is Christ, for whom we have done little, who loves us even upon the cross, and joyfully gave away His life for our preservation.
But I would not take this as absolute evidence that the story is Christian in origin. Indeed, in my fuzzy recollection, I recall a Jewish nimshal for this story, in which the first friend is your money, the second friend is your family, and the third friend is Torah and Mitzvot, which help argue your case and protect you in the next world. It is easy to construct, or to adapt, a nimshal to a story, and the adaptation might have gone either way, especially if one can also make slight changes to the mashal. We need to find earlier sources for this, if possible.
As the translators of the above book noted, the author of Gesta Romanorum got this from the Disciplina Clericalis or Petrus Alphonsi (alternatively known as Pedro Alfonso). (Actually, they only note the author and not the work.) A bit of history about Petrus, but read it all:
Petrus Alphonsi (also known as Peter Alfonsi; born Moses Sephardi) was a Jewish Spanish writer and astronomer, and polemicist, who converted to Christianity.Born at an unknown date in the 11th century and an unknown place within Muslim Spain, he embraced Christianityand was baptized at Huesca on St. Peter's Day, June 29, 1106. In honor of the saint and of his royal patron andgodfather he took the name of Petrus Alfonsi (Alfonso's Peter).Petrus was born a Jew while living in al-Andalus, and after he rose to prominence, he converted to Christianity. This environment gave him an advantageous knowledge of Christianity, Judaism and Islam that would later prove useful in his polemics. John Tolan mentioned in his book Petrus Alfonsi and His Medieval Readers that "Alfonsi’s texts were received enthusiastically—he became an auctor, an authority to be quoted. His success was due in large part to his ability to bridge several cultures: a Jew from the [Muslim] world of al-Andalus." His knowledge of these different religions is what makes Alfonsi unique and why he is essential to be studied when looking at anti-Judaic polemics.
He was a convert to Christianity who attacked Judaism. He attributes at least the first part of the story to Balaam/Lukman, and it seems to be from Arabic origins. On the other hand, perhaps he is being a jerk and taking credit away from some Jewish source.
Petrus' story, though, is more like the one in the article, in that the son has many friends, none of whom help, and it is only the father's half-friend who helps. You can read the story in full on Google Books, when Stanley Applebaum translates this story from Petrus' Disciplina.
(Here, by the way, is a Jewish Spanish version of the story in which the king is replaced with a rabbi.)
So this inspirational story can be traced back at least as far as this odious convert to Christianity; and it is quite possible he got it from Arabic sources. If so, perhaps it should not be so readily adopted as a Jewish story, conveying Jewish values. These might be medieval Christian values, or medieval Muslim values.
If anyone knows of a midrashic work in which this can be found, I would be interested. I am still willing to consider that it started as a Jewish story. In general, it is interesting topic of how these stories infiltrate from one culture and religion to another.
Meanwhile, it just so happens that this week's parsha, Re'ei, discusses friendship and the law. Indeed, it speaks of a dear friend, who is like your own soul. In Devarim 14:7:
Now, there is a hava amina and a maskana in play here. The hava amina is that of course you would cover up for your beloved friend. The maskana is that you should not. But then, this is discussing a very particular case, where he is a meisis to Avodah Zarah. And we know how Hashem regards that! But perhaps the hava amina is not always incorrect, in other situations. What about ritual laws? What about monetary laws? What about ethical laws? There are certainly answers, but I don't know them -- that is, without specialized knowledge, I would not presume to put forth the "Jewish" position on this. Nor am I positive of what I feel the moral position is in every case, because care for those close to you who trust you and who have done kindness to you is probably also a moral value. When Bernie Madoff's sons turned him in, betraying their father, was that a moral thing to do? Was it an immoral thing to do? Was it a trivial, straightforward ethical decision? I don't think there is a straightforward answer here.