Merging multiple data frames by specific column names

Could you provide a reprex of this behavior?
I've tried it and it works just fine (the same way every time):

df1 <- data.frame(col1 = c(1, 2, 3),
                  col2 = c(2, 2, 2),
                  col3 = c("A", "B", "C"))

df2 <- data.frame(Co1 = c(5, 6, 7),
                  Co2 = c(7, 3, 4),
                  Co3 = c("a", "l", "p"))

colnames(df1)
#> [1] "col1" "col2" "col3"

colnames(df1) = colnames(df2)

colnames(df1)
#> [1] "Co1" "Co2" "Co3"