Here is the larger quote from Hebrews 1:8-12 which, as you have rightly commented, is addressed to the Son:
But of the Son he says, “Your throne, O God, is forever and ever, the scepter of uprightness is the scepter of your kingdom. You have loved righteousness and hated wickedness; therefore God, your God, has anointed you with the oil of gladness beyond your companions.” And, “You, Lord, laid the foundation of the earth in the beginning, and the heavens are the work of your hands; they will perish, but you remain; they will all wear out like a garment, like a robe you will roll them up, like a garment they will be changed. But you are the same, and your years will have no end.”
The verses in question (Heb 1:10-12) are a quotation from Psalm 102:24-27:
“O my God,” I say, “take me not away in the midst of my days— you whose years endure throughout all generations!” Of old you laid the foundation of the earth, and the heavens are the work of your hands. They will perish, but you will remain; they will all wear out like a garment. You will change them like a robe, and they will pass away, but you are the same, and your years have no end.
Notice that the passage in Psalms addresses to "O my God" and in Hebrews to "of the Son he says". When linked, as this is, to the creative act of "laying the foundation of the earth" and immersed in the eternal nature expressed by "you whose years endure throughout all generations" and "your years have no end" it is, indeed, a strong thread of evidence for the triune nature of the Godhead.
John begins his Gospel in just the same way appealing to the same two elements of creation and eternality:
In the beginning was the Word, and the Word was with God, and the Word was God. He was in the beginning with God. All things were made through him, and without him was not any thing made that was made.- John 1:1-3
This Word, this Logos, is the Divine mind. It is not merely the Word as spoken expression but it is inseparable from the thought and intention behind that which is spoken. As there can be no ontological difference between what an infinite, eternal God of perfect integrity thinks, says, and does and what that God actually is, therefore the Word (Divine thought and intent) was God.
There are those who imagine a time where God the Father existed prior to creating the Word. This necessitates either diminishing the Word (which some do), adding phrases to the text (as some do), or imagining God existing for a time with neither thought nor intention.
But we have, very clearly "In the beginning God..." prior to creation without beginning or end. And we have equally clearly "In the beginning was the Word and the Word was with God and the Word was God..." prior to creation and without beginning or end.
He (the Word) was in the beginning with God. This beginning is intended to bring us to Genesis 1:1.
The same He (the Word) was God at that point.
He both was God and also with God.
This is why the writer of Hebrews can say some of the same things about the Son as are said of God himself.