My friends scolded me for doing something stupid.

Literal

Friends [topic-は] I [subject-が] foolish thing [object-を] did [quotative-と] scolded.

The quotative と packages the entire clause 私が馬鹿なことをした as the content or reason for the scolding. 叱る (しかる) specifically means to scold or reprimand — stronger than 注意する but less harsh than 怒る. The embedded が marks the subject within the subordinate clause.