Okay! Here is the function:

```cpp
#include <iostream>
#include <cmath>

using namespace std;

int sum_of_powers(int n, int k) {
    int sum = 0;
    sum = (n*(n+1))/2; // sum of natural numbers from 1 to n
    int sum_of_powers = pow(sum, k); // sum of powers from 1 to n
    return sum_of_powers;
}

int main() {
    int n, k;
    cout << "Enter two positive integers n and k: ";
    cin >> n >> k;
    int result = sum_of_powers(n, k);
    cout << "The sum of the numbers from 1^k to n^k is: " << result << endl;
    return 0;
}
```

Let me know if you need any more help with your code!
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence