This is actually a tough question. I don't know the curriculum of your class, but I can see that an introduction to the standard library has a lot of nuances.
An iterator is a full blown object. It really does not know anything about your Soldier structure. It knows how to work with the std::list that contains your Solders. It is full of overloaded operators. And at this point I can see where the waters get muddy. So you have not learned yet about operator overloading but you are going to use use it? You are expected to treat the iterator like a black box so you must follow certain rules blindly. If this is the case, you should have been told that an iterator has access to your objects in the container and the only way to get to that object is with a magic it->thing
.
If you have learned about overloading it should have been pointed out that the -> is an iterator overload. the operator returns a pointer to your object. Or, at the least, you could just think of the iterator as a raw pointer, it looks the same. Have you been introduced to pointers yet?
And, as it has come up.
for( auto& item : container )...;
Is a language construct. It simply does the same as:
for (it = company.begin(); it != company.end(); it++)
{
auto& item= *it;
std::cout << item.index << std::endl;
}
And there it is again, treating the iterator like a pointer and this time using the asterisk operator.
https://en.cppreference.com/w/cpp/language/operator_member_access#Built-in_indirection_operator
If you are going to be a proficient c++ programmer you have to learn how the language and the standard library work.
Also, please get out of the habit of:
using namespace std;